// eslint-disable-next-line
import { UserLayout, BasicLayout, BlankLayout, PageView,RouteView } from '@/layouts'
import { bxAnaalyse } from '@/core/icons'
// import RouteView from '@/layouts/RouteView'


// const RouteView = {
//   name: 'RouteView',
//   render: h => h('router-view')
// }

export const asyncRouterMap = [
  {
    path: '/',
    name: 'home',
    component: BasicLayout,
    meta: { title: '首页' },
    redirect: '/home',
    children: [

      // 供应商首页
      {
        path: '/home',
        name: 'HomePage_s',
        component: () => import('@/views/HomeOrg'),
        meta: { title: '首页', icon: 'setting', permission: ['saleJob'] },
        hidden: false
      },

      // 采购用户首页
      {
        path: '/home',
        name: 'HomePage_h',
        component: () => import('@/views/Home1'),
        meta: { title: '首页', icon: 'setting', permission: ['purchaseJob'] },
        hidden: false
      },

      // 平台基础信息
      {
        path: '/platformData',
        hiddenHeaderContent: false,
        component: RouteView,
        meta: { title: '平台基础数据库', icon: 'form', permission: ['platformData_'] },
        redirect: '/platformData/supplierLicense_passed',
        children: [
          {
            path: '/platformData/platformGoodsInfo',
            name: 'platformGoodsInfo',
            hiddenHeaderContent: false,
            component: () => import('@/views/app/biz/platformData/PlatformGoodsInfo'),
            meta: { title: '商品目录', icon: 'form', hiddenHeaderContent: false, keepAlive: false }
          },
          // {
          //   path: '/platformData/platformGoodsInfo',
          //   name: 'platformGoodsInfo',
          //   component: () => import('@/views/app/biz/platformData/PlatformGoodsInfo'),
          //   meta: { title: '商品信息管理', icon: 'form', keepAlive: false, permission: ['platformGoodsInfo'] }
          // }
        ]
      },
      // 客服中心
      {
        path: '/customer',
        component: RouteView,
        meta: { title: '客户中心', icon: 'copy', permission: ['customerManager'] },
        redirect: '/customer/customerManage',
        children: [
          {
            path: '/customer/customerManage',
            name: 'customerInfo',
            component: () => import('@/views/app/biz/customer/customerManager'),
            meta: { title: '客户信息', icon: 'snippets', keepAlive: false, permission: ['customerInfo'] }
          },
          {
            path: '/customer/addCustomer',
            name: 'addCustomer',
            hidden: true,
            component: () => import('@/views/app/biz/customer/add'),
            meta: { title: '新增、编辑客户信息', icon: 'snippets', keepAlive: true, permission: ['customerInfo'] }
          },
          {
            path: '/salesGoods/saleGoodsStore',
            name: 'saleGoodsStore',
            component: () => import('@/views/app/biz/salesGoods/saleGoodsStore'),
            meta: { title: '客户商品对照', icon: 'form', keepAlive: false, editable: false, permission: ['goodsConnect'] }
          },
          {
            path: '/salesGoods/saleGoodsMatch',
            name: 'saleGoodsMatch',
            hidden: true,
            component: () => import('@/views/app/biz/salesGoods/saleGoodsMatch'),
            meta: { title: '客户商品对照', icon: 'form', keepAlive: false, editable: false, permission: ['productionManager'] }
          }
        ]
      },
      // 订单中心
      {
        path: '/saleOrderManager',
        component: RouteView,
        meta: { title: '订单中心', icon: 'container', permission: ['saleOrderManager'] },
        redirect: '/saleOrder',
        children: [
          {
            path: '/saleOrder',
            name: 'saleOrderManage',
            component: () => import('@/views/app/biz/saleOrder/saleOrderManage'),
            meta: { title: '销售订单', icon: 'form', keepAlive: false, permission: ['saleOrderManager'] }
          },
        ]
      },
      // 采购目录
      {
        path: '/purchaseGoods',
        component: RouteView,
        meta: { title: '采购目录', icon: 'container', permission: ['goodsManager'] },
        redirect: '/purchaseGoods/goodsStore',
        children: [
          // 产品目录
          {
            path: '/purchaseGoods/goodsStore',
            name: 'goodsStore',
            component: () => import('@/views/app/biz/purchasedGoods/goodsStore'),
            meta: { title: '产品目录', icon: 'form', keepAlive: false, permission: ['goodsManager'] }
          },
          {
            path: '/addGoods',
            name: 'addGoods',
            hidden: true,
            component: () => import('@/views/app/biz/purchasedGoods/add'),
            meta: { title: '新增、编辑产品', icon: 'snippets', keepAlive: true }
          },
          // // 产品列表
          // {
          //   path: '/purchaseGoods/goodsList',
          //   name: 'goodsList',
          //   component: () => import('@/views/app/biz/purchasedGoods/goodsList'),
          //   meta: { title: '产品列表', icon: 'form', keepAlive: false, permission: ['goodsManager'] ,zhuangTai:'4'}
          // },
        ]
      },
      // 采购基础信息
      {
        path: '/goodsManager',
        component: RouteView,
        name: 'goods',
        meta: { title: '供应商管理', icon: 'container', permission: ['goodsManager'] },
        redirect: '/goodsManager/supplier',
        children: [
          // 供应商基本信息
          {
            path: '/supplier',
            name: 'supplierInfo',
            component: () => import('@/views/app/biz/supplier/SupplierManager'),
            meta: { title: '供应商基本信息', icon: 'project', keepAlive: false, permission: ['supplierInfo'] }
          },
          {
            path: '/addSupplier',
            name: 'addSupplier',
            hidden: true,
            component: () => import('@/views/app/biz/supplier/add'),
            meta: { title: '新增、编辑供应商', icon: 'snippets', keepAlive: true }
          },
          {
            path: '/goodsManager/goods',
            name: 'goods',
            component: () => import('@/views/app/biz/purchasedGoods/purchasedGoodsManage'),
            meta: { title: '供应商商品管理', icon: 'form', keepAlive: false, permission: ['goodsManager'], zhuangTai: '4' }
          }
        ]
      },
      // 采购中心
      {
        path: '/purchaseOrdersManager',
        component: RouteView,
        meta: { title: '采购中心', icon: 'container', permission: ['purchaseOrdersManager'] },
        redirect: '/purchaseOrder',
        children: [
          {
            path: '/purchaseOrder',
            name: 'purchaseOrderManage',
            component: () => import('@/views/app/biz/purchaseOrder/purchaseOrderManage'),
            meta: { title: '采购订单', icon: 'form', keepAlive: false, permission: ['purchaseOrder'] }
          },
          {
            path: '/addPurchaseOrder',
            name: 'addPurchaseOrder',
            hidden: true,
            component: () => import('@/views/app/biz/purchaseOrder/add.vue'),
            meta: { title: '新增采购订单', icon: 'form', keepAlive: true, },
          },
        ]
      },
      // 配送中心
      {
        path: '/purchaseDelivery',
        component: RouteView,
        meta: { title: '配送中心', icon: 'container', permission: ['purchaseOrdersManager'] },
        redirect: '/purchaseDeliveryManage',
        children: [
          {
            path: '/purchaseDelivery',
            name: 'purchaseDeliveryManage',
            component: () => import('@/views/app/biz/purchaseDelivery/purchaseDeliveryManage'),
            meta: { title: '配送单', icon: 'form', keepAlive: false, permission: ['purchaseOrder'] }
          },
          {
            path: '/purchaseDelivery/deliveryDetail',
            name: 'deliveryDetail',
            hidden: true,
            component: () => import('@/views/app/biz/purchaseDelivery/viewDeliveryOrder'),
            meta: { title: '配送单详情', icon: 'form', keepAlive: true, permission: ['purchaseOrder'] }
          },
        ]
      },
      // 配送中心
      {
        path: '/saleDelivery',
        component: RouteView,
        meta: { title: '配送中心', icon: 'form', permission: ['deliveryManager'] },
        redirect: '/saleDelivery/saleDeliveryManage',
        children: [
          // {
          //   path: '/saleDelivery/saleDeliveryManage',
          //   name: 'saleDeliveryManage',
          //   component: () => import('@/views/app/biz/saleDelivery/saleDeliveryManage'),
          //   meta: { title: '销售单配送（删）', icon: 'form', keepAlive: false, permission: ['deliveryOrder'] }
          // },
          {
            path: '/undeliveredOrder',
            name: 'undeliveredOrder',
            component: () => import('@/views/app/biz/saleDelivery/undeliveredOrder'),
            meta: { title: '未配送', icon: 'form', keepAlive: false, permission: ['saleOrderManager'] }
          },
          {
            path: '/saleDelivery/mergeOrder',
            name: 'mergeOrder',
            hidden: true,
            component: () => import('@/views/app/biz/saleDelivery/mergeOrder'),
            meta: { title: '合并配送', icon: 'form', keepAlive: true, permission: ['deliveryOrder'] }
          },
          {
            path: '/saleDelivery/deliverOrderyManage',
            name: 'deliverOrderyManage',
            component: () => import('@/views/app/biz/saleDelivery/deliveryOrderManage'),
            meta: { title: '配送中', zhuangTai: "待收货", icon: 'form', keepAlive: false, permission: ['deliveryOrder'] }
          },
          {
            path: '/saleDelivery/mergeEdit',
            name: 'mergeEdit',
            hidden: true,
            component: () => import('@/views/app/biz/saleDelivery/mergeEdit'),
            meta: { title: '修改配送信息', icon: 'form', keepAlive: false, permission: ['deliveryOrder'] }
          },
          {
            path: '/saleDelivery/mergeDetail',
            name: 'mergeDetail',
            hidden: true,
            component: () => import('@/views/app/biz/saleDelivery/viewDeliveryOrder'),
            meta: { title: '配送单详情', icon: 'form', keepAlive: true, permission: ['deliveryOrder'] }
          },
          {
            path: '/saleDelivery/receivedOrder',
            name: 'receivedOrder',
            component: () => import('@/views/app/biz/saleDelivery/deliveryOrderManage'),
            meta: { title: '已收货', zhuangTai: '已收货`#`已拒收`#`部分收货', icon: 'form', keepAlive: false, permission: ['deliveryOrder'] }
          },
          {
            path: '/saleDelivery/revokedOrder',
            name: 'revokedOrder',
            component: () => import('@/views/app/biz/saleDelivery/deliveryOrderManage'),
            meta: { title: '已作废', zhuangTai: '已作废', icon: 'form', keepAlive: false, permission: ['deliveryOrder'] }
          },

        ]
      },
      // 结算中心
      {
        path: '/settlement',
        component: RouteView,
        meta: { title: '结算和发票', icon: 'form', permission: ['settlementManager'] },
        redirect: '/settlement/settlementByDelivery',
        children: [
          {
            path: '/settlement/settlementByDelivery',
            name: 'settlementByDelivery',
            component: () => import('@/views/app/biz/settlement/settlementOrder'),
            meta: { title: '货票同行', settlementType: '货票同行', icon: 'form', keepAlive: false, editable: false, permission: ['saleOrderManager'] }
          },
          {
            path: '/Invoicing',
            name: 'toInvoicing',
            hidden: true,
            component: () => import('@/views/app/biz/settlementInvoice/toInvoicing'),
            meta: { title: '开具发票', icon: 'snippets', keepAlive: true, permission: ['settlement'] }
          },
          {
            path: '/settlement/settlementOrder',
            name: 'settlementOrder',
            component: () => import('@/views/app/biz/settlement/settlementOrder'),
            meta: { title: '用后结算',settlementType: '用后结算', icon: 'form', keepAlive: false, editable: false, permission: ['purchaseOrder'] }
          },
          {
            path: '/settlement/settlementOrder_s',
            name: 'settlementOrder_s',
            component: () => import('@/views/app/biz/settlement/settlementOrder'),
            meta: { title: '用后结算',settlementType: '用后结算', icon: 'form', keepAlive: false, editable: false, permission: ['saleOrderManager'] }
          },
          {
            path: '/addSettlement',
            name: 'addSettlement',
            hidden: true,
            component: () => import('@/views/app/biz/settlement/add'),
            meta: { title: '新增、编辑结算单', icon: 'snippets', keepAlive: true, permission: ['settlement'] }
          },
          {
            path: '/settlement/invoice',
            name: 'invoice_s',
            hidden: false,
            component: () => import('@/views/app/biz/settlementInvoice/invoiceManage.vue'),
            meta: { title: '发票', icon: 'form', keepAlive: false, editable: true, permission: ['customerInfo'] }
          },
           {
            path: '/settlement/invoice',
            name: 'invoice',
            hidden: false,
            component: () => import('@/views/app/biz/settlementInvoice/invoiceManage.vue'),
            meta: { title: '发票', icon: 'form', keepAlive: false, editable: true, permission: ['supplierInfo'] }
          },
          {
            path: '/addInvoice',
            name: 'addInvoice',
            hidden: true,
            component: () => import('@/views/app/biz/settlementInvoice/add'),
            meta: { title: '新增、编辑发票', icon: 'snippets', keepAlive: true, permission: ['invoice'] }
          },
        ]
      },
      // 证照中心
      {
        path: '/licenseManage_s',
        component: RouteView,
        meta: { title: '证照中心', icon: 'form', permission: ['licenseManager'] },
        redirect: '/licenseManage_s/addRegisLicense',
        children: [
          {
            path: '/licenseManage_s/addRegisLicense',
            name: 'addRegisLicense',
            component: () => import('@/views/app/biz/regisLicense/regisLicenseManage_s.vue'),
            meta: { title: '注册证管理', icon: 'form', keepAlive: false, permission: ['regisLicense'] },
          },
          {
            path: '/addRegLicense',
            name: 'addRegLicense',
            hidden: true,
            component: () => import('@/views/app/biz/regisLicense/add'),
            meta: { title: '新增、编辑注册证', icon: 'snippets', keepAlive: false, permission: ['regisLicense'] }
          },
          {
            path: '/licenseManage_s/companyLicense',
            name: 'companyLicense',
            component: () => import('@/views/app/biz/companyLicense/companyLicense_s.vue'),
            meta: { title: '企业证照管理', icon: 'form', keepAlive: false, permission: ['companyLicense'] }
          },
          {
            path: '/addCmpLicense',
            name: 'addCmpLicense',
            hidden: true,
            component: () => import('@/views/app/biz/companyLicense/add'),
            meta: { title: '新增、编辑企业证照', icon: 'snippets', keepAlive: false, permission: ['companyLicense'] }
          },
          {
            path: '/manufacturerManage',
            name: 'manufacturerManage',
            component: () => import('@/views/app/biz/manufacturer/manufacturerManage.vue'),
            meta: { title: '生产企业管理', icon: 'form', keepAlive: false, permission: ['regisLicense'] },
          },
          {
            path: '/addManufacturer',
            name: 'addManufacturer',
            hidden: true,
            component: () => import('@/views/app/biz/manufacturer/add'),
            meta: { title: '新增、编辑生产企业', icon: 'snippets', keepAlive: true, permission: ['regisLicense'] }
          },
          {
            path: '/licenseManage_h_opt/a/supplierLicense_p',
            name: 'supplierLicense',
            hidden:false,
            component: () => import('@/views/app/biz/companyLicense/companyLicense_p'),
            meta: { title: '供应商企业证照', icon: 'form', keepAlive: false, permission: ['supplierRegisLicense'], zhuangTai: '1`#`2`#`3`#`4`#`5' },
          },
          {
            path: '/licenseManage_h_opt/a/registerLicense_p',
            name: 'registerLicense',
            hidden:false,
            component: () => import('@/views/app/biz/regisLicense/regisLicenseManage_p'),
            meta: { title: '供应商上传注册证', icon: 'form', keepAlive: false, permission: ['supplierRegisLicense'], zhuangTai: '1`#`2`#`3`#`4`#`5' },
          },
          {
            path: '/licenseOnHospital',
            name: 'licenseOnHospital',
            component: () => import('@/views/app/biz/licenseOnHospital/licenseOnHospital'),
            meta: { title: '证照管理', icon: 'form', keepAlive: false, permission: ['supplierRegisLicense'] },
          }
        ]
      },
      // // 生产企业
      // {
      //   path: '/manufacturer',
      //   component: RouteView,
      //   meta: { title: '生产企业', icon: 'form', permission: ['regisLicense'] },
      //   redirect: '/manufacturer/manufacturerManage',
      //   children: [
      //     {
      //       path: '/manufacturer/manufacturerManage',
      //       name: 'manufacturerManage',
      //       component: () => import('@/views/app/biz/manufacturer/manufacturerManage.vue'),
      //       meta: { title: '生产企业管理', icon: 'form', keepAlive: false, permission: ['regisLicense'] },
      //     },
      //   ]
      // },

      // 配送地址管理
      {
        path: '/deliveryAddress',
        component: RouteView,
        meta: { title: '配送地址', icon: 'form', },
        redirect: '/deliveryAddress/deliveryAddressManage',
        children: [
          {
            path: '/deliveryAddressManage',
            name: 'deliveryAddressManage',
            component: () => import('@/views/app/biz/deliveryAddress/deliveryAddressManage.vue'),
            meta: { title: '配送地址管理', icon: 'form', keepAlive: false, },
          },
          {
            path: '/addDeliveryAddress',
            name: 'addDeliveryAddress',
            hidden: true,
            component: () => import('@/views/app/biz/deliveryAddress/add'),
            meta: { title: '新增、编辑配送地址', icon: 'snippets', keepAlive: true }
          },
        ]
      },
      // 发票抬头管理
      {
        path: '/invoiceInfo',
        component: RouteView,
        meta: { title: '发票信息', icon: 'form', },
        redirect: '/invoiceInfo/invoiceInfoManage',
        children: [
          {
            path: '/invoiceInfo/invoiceInfoManage',
            name: 'invoiceInfoManage',
            component: () => import('@/views/app/biz/invoiceInfo/invoiceInfoManage.vue'),
            meta: { title: '发票抬头管理', icon: 'form', keepAlive: false, },
          },
          {
            path: '/addInvoiceInfo',
            name: 'addInvoiceInfo',
            hidden: true,
            component: () => import('@/views/app/biz/invoiceInfo/add'),
            meta: { title: '新增、编辑发票抬头', icon: 'snippets', keepAlive: true }
          },
        ]
      },
      // 消息通知管理
      {
        path: '/notification',
        component: RouteView,
        meta: { title: '消息通知', icon: 'form', },
        redirect: '/notification/notificationManage',
        children: [
          {
            path: '/notification/notificationManage',
            name: 'notificationManage',
            component: () => import('@/views/app/biz/notification/notificationManage.vue'),
            meta: { title: '消息通知管理', icon: 'form', keepAlive: false, },
          },
          {
            path: '/notification/addNotification',
            name: 'addNotification',
            hidden: true,
            component: () => import('@/views/app/biz/notification/add.vue'),
            meta: { title: '新增、编辑消息通知', icon: 'form', keepAlive: true, },
          },
        ]
      },

      // 组织机构管理
      {
        path: '/org',
        component: RouteView,
        hiddenHeaderContent: true,
        meta: { title: '机构人事', icon: 'bank', permission: ['org'] },
        redirect: '/org/depart',
        children: [
          {
            path: '/org/depart',
            name: 'Department',
            component: () => import('@/views/sys/org/department/Department'),
            hiddenHeaderContent: true,
            meta: { title: '部门管理', icon: 'cluster', hiddenHeaderContent: true, keepAlive: true, permission: ['depart'] }
          },
          {
            path: '/org/departmanager',
            name: 'DepartmentManager',
            component: () => import('@/views/sys/org/department/DepartmentManager'),
            hiddenHeaderContent: true,
            meta: { title: '人事管理', icon: 'cluster', hiddenHeaderContent: true, keepAlive: true, permission: ['departmanager'] }
          },
          {
            path: '/org/orgMembers',
            name: 'OrgMembers',
            component: () => import('@/views/sys/org/org/OrgMembers'),
            hiddenHeaderContent: true,
            meta: { title: '人员管理', icon: 'team', hiddenHeaderContent: true, keepAlive: true, permission: ['person1'] }
          },
          {
            path: '/org/org',
            name: 'Organization',
            component: () => import('@/views/sys/org/org/Organization'),
            hiddenHeaderContent: true,
            meta: { title: '单位管理', icon: 'appstore', keepAlive: true, permission: ['organization'], hiddenHeaderContent: true }
          }
        ]
      },

      // 权限管理
      {
        path: '/auth',
        component: RouteView,
        meta: { title: '权限管理', icon: 'key', permission: ['auth'] },
        redirect: '/auth/role',
        children: [
          {
            path: '/auth/role',
            name: 'RoleManager',
            component: () => import('@/views/sys/auth/RoleManager'),
            hiddenHeaderContent: true,
            meta: { title: '角色管理', icon: 'idcard', hiddenHeaderContent: true, keepAlive: true, permission: ['role'] }
          },
          {
            path: '/auth/orgAuth',
            name: 'orgAuthManager',
            component: () => import('@/views/sys/auth/orgAuthManager'),
            hiddenHeaderContent: true,
            meta: { title: '机构权限管理', icon: 'schedule', hiddenHeaderContent: true, keepAlive: true, permission: ['orgAuth'] }
          }
        ]
      },
      // 系统管理
      {
        path: '/sysSettings',
        component: RouteView,
        meta: { title: '系统管理', icon: 'setting', hiddenHeaderContent: true, permission: ['sys'] },
        redirect: '/sysSettings/menu',
        children: [
          {
            path: '/sysSettings/menu',
            name: 'MenuManager',
            component: () => import('@/views/sys/menu/MenuManager'),
            hiddenHeaderContent: true,
            meta: { title: '菜单管理', icon: 'project', keepAlive: true, permission: ['menu'] }
          },
          {
            path: '/sysSettings/dict',
            name: 'DictManager',
            component: () => import('@/views/sys/dict/DictManager'),
            hiddenHeaderContent: true,
            meta: { title: '字典管理', icon: 'database', keepAlive: true, permission: ['dict'] }
          },
          // {
          //   path: '/sysSettings/test',
          //   name: 'test',
          //   component: () => import('@/views/sys/test/index'),
          //   hiddenHeaderContent: true,
          //   meta: { title: 'test', icon: 'file', keepAlive: false, permission: ['dict'] }
          // },
          // {
          //   path: '/sysSettings/basicTable',
          //   name: 'basicTable',
          //   component: () => import('@/views/projectE/basicTable'),
          //   hiddenHeaderContent: true,
          //   meta: { title: 'Basic Table', icon: 'file', keepAlive: true, permission: ['dict'] }
          // },
          // {
          //   path: '/sysSettings/homes',
          //   name: 'homes',
          //   component: () => import('@/views/projectE/home'),
          //   hiddenHeaderContent: true,
          //   meta: { title: 'home', icon: 'file', keepAlive: true, permission: ['dict'] }
          // }
        ]
      },
      // account
      {
        path: '/account',
        component: RouteView,
        redirect: '/account/center',
        name: 'account',
        hiddenHeaderContent: true,
        meta: { title: '个人页', icon: 'user', keepAlive: true },
        children: [
          // {
          //   path: '/account/center',
          //   name: 'center',
          //   component: () => import('@/views/account/center/Index'),
          //   meta: { title: '个人中心', keepAlive: true, permission: [ 'user' ] }
          // },
          {
            path: '/account/settings',
            name: 'settings',
            component: () => import('@/views/account/settings/Index'),
            meta: { title: '个人设置', icon: 'user', hideHeader: true },
            redirect: '/account/settings/ChangePasswd',
            hideChildrenInMenu: true,
            children: [
              {
                path: '/account/settings/ChangePasswd',
                name: 'ChangePasswd',
                component: () => import('@/views/account/settings/ChangePasswd'),
                meta: { title: '修改密码', keepAlive: true }
              }
            ]
          },
          {
            path: '/account/tool',
            name: 'tool',
            component: () => import('@/views/account/tool'),
            meta: { title: '字段转换工具', icon: 'user', hideHeader: true }
          },
          {
            path: '/account/common',
            name: 'common',
            component: () => import('@/views/app/common/demo/demo'),
            meta: { title: '组件测试', icon: 'user',}
          }
        ]
      }
    ]
  }
]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
  {
    path: '/user',
    component: UserLayout,
    redirect: '/user/login',
    hidden: true,
    children: [
      {
        path: 'login',
        name: 'login',
        component: () => import('@/views/user/Login')
      },
      {
        path: 'selectOrg',
        name: 'selectOrg',
        component: () => import('@/views/user/SelectOrg'),
        meta: { title: '单位选择', keepAlive: true }
      }
    ]
  },

  {
    path: '/404',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
  }
]
